package com.recruit.server.controller;

import com.recruit.server.common.HeaderInfo;
import com.recruit.server.request.order.AddOrderRequest;
import com.recruit.server.request.order.ListOrderRequest;
import com.recruit.server.request.order.UpdateOrderRequest;
import com.recruit.server.response.order.AddOrderResponse;
import com.recruit.server.response.order.ListOrderResponse;
import com.recruit.server.response.order.UpdateOrderResponse;
import com.recruit.server.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService iOrderService;

    @PostMapping("/list")
    public ListOrderResponse list(@Validated @RequestBody ListOrderRequest request, HeaderInfo headerInfo) {
        return iOrderService.list(request, headerInfo);
    }

    @PostMapping("/add")
    public AddOrderResponse add(@Validated @RequestBody AddOrderRequest request, HeaderInfo headerInfo) {
        return iOrderService.add(request, headerInfo);
    }
}
